{template 'header', 'member'}
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td width="110" id="submenu"></td>
<td class="tab" id="add"><a href="?mid={$mid}&job={$job}&action=add"><span>创建商圈</span></a></td>
<td class="tab" id="s3"><a href="?mid={$mid}&job={$job}"><span>已开通({$nums[3]})</span></a></td>
<td class="tab" id="s2"><a href="?mid={$mid}&job={$job}&status=2"><span>审核中({$nums[2]})</span></a></td>
<td class="tab" id="s1"><a href="?mid={$mid}&job={$job}&status=1"><span>未通过({$nums[1]})</span></a></td>
</tr>
</table>
</div>
{if $action=='add' || $action=='edit'}
<iframe src="" name="send" id="send" style="display:none;"></iframe>
<form method="post" action="?" id="dform" target="send" onsubmit="return check();">
<input type="hidden" name="action" value="{$action}"/>
<input type="hidden" name="mid" value="{$mid}"/>
<input type="hidden" name="job" value="{$job}"/>
<input type="hidden" name="itemid" value="{$itemid}"/>
<input type="hidden" name="forward" value="{$forward}"/>
<table cellpadding="10" cellspacing="1" class="tb">
{if $status==1 && $action=='edit' && $note}
<tr>
<td class="tl">未通过原因</td>
<td class="tr f_blue">{$note}</td>
</tr>
{/if}
<tr{if $action=='edit'} style="display:none;"{/if}>
<td class="tl"><span class="f_red">*</span> 所属分类</td>
<td class="tr">{category_select('post[catid]', '选择分类', $catid, $moduleid)} <span class="f_gray">创建后无法修改</span>  <span id="dcatid" class="f_red"></span></td>
</tr>

<tr>
<td class="tl"><span class="f_red">*</span> 商圈名称</td>
<td class="tr"><input name="post[title]" type="text" id="title" size="20" value="{$title}"{if $action=='edit'} readonly{/if}/>{if $action=='add'} <span class="f_gray">限15个字，创建后无法修改</span>{/if} <span id="dtitle" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> 商圈图标</td>
<td class="tr"><input name="post[thumb]" id="thumb" type="text" size="60" value="{$thumb}" readonly/>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="Dthumb({$moduleid},128,128, Dd('thumb').value, true);" class="t">[上传]</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="_preview(Dd('thumb').value);" class="t">[预览]</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="Dd('thumb').value='';" class="t">[删除]</a> <span id="dthumb" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> 商圈简介</td>
<td class="tr"><textarea name="post[content]" id="content" style="width:90%;height:80px;">{$content}</textarea><br/><span class="f_gray">限500个字</span> <span id="dcontent" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> 加圈方式</td>
<td class="tr">
<input type="radio" name="post[join_type]" value="0"{if $join_type == 0} checked{/if}/> 自由
<input type="radio" name="post[join_type]" value="1"{if $join_type == 1} checked{/if}/> 申请
</td>
</tr>
{if $action == 'add'}
<tr>
<td class="tl"><span class="f_red">*</span> 创建理由</td>
<td class="tr"><textarea name="post[reason]" id="reason" style="width:90%;height:80px;">{$reason}</textarea><br/><span class="f_gray">限500个字</span> <span id="dreason" class="f_red"></span></td>
</tr>
{/if}
{if $need_question}
<tr>
<td class="tl"><span class="f_red">*</span> 验证问题</td>
<td class="tr">{template 'question', 'chip'} <span id="danswer" class="f_red"></span></td>
</tr>
{/if}
{if $need_captcha}
<tr>
<td class="tl"><span class="f_red">*</span> 验证码</td>
<td class="tr">{template 'captcha', 'chip'} <span id="dcaptcha" class="f_red"></span></td>
</tr>
{/if}
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="50"><input type="submit" name="submit" value=" 提 交 " class="btn_g"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value=" 返 回 " class="btn" onclick="history.back(-1);"/></td>
</tr>
</table>
</form>
{if $action=='add'}
<script type="text/javascript">s('mid_{$mid}');m('{$action}');</script>
{else}
<script type="text/javascript">s('mid_{$mid}');m('s{$status}');</script>
{/if}
{else}
<div class="tt">
<form action="?">
<input type="hidden" name="mid" value="{$mid}"/>
<input type="hidden" name="job" value="{$job}"/>
<input type="hidden" name="status" value="{$status}"/>
&nbsp;{category_select('catid', '所有分类', $catid, $moduleid)}&nbsp;
<input type="text" size="50" name="kw" value="{$kw}" title="关键词"/>&nbsp;
<input type="submit" value=" 搜 索 " class="btn"/>&nbsp;
<input type="button" value=" 重 置 " class="btn" onclick="Go('?mid={$mid}&job={$job}&status={$status}');"/>
</form>
</div>
<div class="ls">
<table cellpadding="10" cellspacing="0" class="tb">
<tr>
<th width="100">图标</th>
<th>名称</th>
<th>分类</th>
<th width="130">创建时间</th>
<th>主题</th>
<th>粉丝</th>
<th width="40">管理</th>
</tr>
{loop $lists $k $v}
<tr align="center">
<td><a href="javascript:_preview('{$v[thumb]}');"><img src="{$v[thumb]}" width="80" class="thumb"/></a></td>
<td><a href="{$v[linkurl]}" target="_blank" class="t">{$v[title]}</a>{if $v[status]==1 && $v[note]} <a href="javascript:" onclick="alert('{$v[note]}');"><img src="image/why.gif" title="未通过原因"/></a>{/if}</td>
<td>&nbsp;&nbsp;<a href="{$v[caturl]}" target="_blank">{$v[catname]}</a>&nbsp;&nbsp;</td>
<td class="f_gray">{$v[adddate]}</td>
<td><a href="javascript:Dwidget('?mid={$mid}&job=manage&action=post&gid={$v[itemid]}', '[{$v[title]}]帖子管理');"><span class="f_gray">{$v[post]}</span></a></td>
<td><a href="?mid={$mid}&job=fans&gid={$v[itemid]}"><span class="f_gray">{$v[fans]}</span></a></td>
<td>
<a href="?mid={$mid}&job={$job}&action=edit&itemid={$v[itemid]}"><img width="16" height="16" src="image/edit.png" title="修改" alt=""/></a>
</td>
</tr>
{/loop}
</table>
</div>
{if $group_limit}
<div class="limit">
总共可建 <span class="f_b f_red">{$group_limit}</span> 个&nbsp;&nbsp;&nbsp;
当前已建 <span class="f_b">{$limit_used}</span> 个&nbsp;&nbsp;&nbsp;
还可以建 <span class="f_b f_blue">{$limit_free}</span> 个&nbsp;&nbsp;&nbsp;
</div>
{/if}
<div class="pages">{$pages}</div>
<script type="text/javascript">s('mid_{$mid}');m('s{$status}');</script>
{/if}
{if $action == 'add' || $action == 'edit'}
<script type="text/javascript">
function check() {
	var l;
	var f;
	f = 'catid_1';
	if(Dd(f).value == 0) {
		Dmsg('请选择所属分类', 'catid', 1);
		return false;
	}
	f = 'title';
	l = Dd(f).value.length;
	if(l < 2 || l > 15) {
		Dmsg('商圈名称应为2-15字，当前已输入'+l+'字', f);
		return false;
	}
	f = 'thumb';
	l = Dd(f).value.length;
	if(l < 10) {
		Dmsg('请上传商圈图标', f);
		return false;
	}
	f = 'content';
	l = Dd(f).value.length;
	if(l < 10 || l > 500) {
		Dmsg('商圈简介应为10-500字，当前已输入'+l+'字', f);
		return false;
	}
{if $action == 'add'}
	f = 'reason';
	l = Dd(f).value.length;
	if(l < 10 || l > 500) {
		Dmsg('创建理由应为10-500字，当前已输入'+l+'字', f);
		return false;
	}
{/if}
{if $need_password}
	f = 'password';
	l = Dd(f).value.length;
	if(l < 6) {
		Dmsg('请填写支付密码', f);
		return false;
	}
{/if}
{if $need_question}
	f = 'answer';
	if($('#c'+f).html().indexOf('ok.png') == -1) {
		Dmsg('请填写正确的验证问题', f);
		return false;
	}
{/if}
{if $need_captcha}
	f = 'captcha';
	if($('#c'+f).html().indexOf('ok.png') == -1) {
		Dmsg('请填写正确的验证码', f);
		return false;
	}
{/if}
	return true;
}
</script>
{/if}
{template 'club_js', 'chip'}
{template 'footer', 'member'}